<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <title>weex-starter</title>
  <meta name="viewport" content="width=750, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <meta name="apple-touch-fullscreen" content="yes" />
  <meta name="format-detection" content="telephone=no, email=no" />
  <style>
    html, body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
    }
    #qrcode {
      position: absolute;
      left: 0;
      top: 0;
    }
  </style>
  <script src="./node_modules/vue/dist/vue.runtime.min.js"></script>
  <script src="./node_modules/weex-vue-render/dist/index.js"></script>
</head>

<body>
  <div id="root"></div>
  <div id="qrcode"></div>
  <script src="./qrcode.min.js"></script>
  <script>
    ;(function () {
      var defaultPage = 'index.web.js'

      var match = location.search.match(new RegExp('[?|&]page=([^&]+)'))
      var page = match && match[1]
      if (!page) {
        return location.href = location.href.replace(/\?|$/, function (f) {
          var query = '?page=' + defaultPage
          return f ? query + '&' : query
        })
      }

      var $script = document.createElement('script')
      $script.src = './dist/' + page
      document.body.appendChild($script)

      new QRCode(document.getElementById("qrcode"), {
        text: location.origin + '/dist/' + page.replace('.web', ''),
        width: 128,
        height: 128
      });
    })();
  </script>
</body>

</html>
